//
//  UIBarButtonItem_Extension.swift
//  JFDouYu
//
//  Created by xujf on 2017/11/13.
//  Copyright © 2017年 XuJF. All rights reserved.
//

import Foundation
import UIKit
extension UIBarButtonItem{
    class func creatImge(imageName:String,highImageName:String,size:CGSize) ->UIBarButtonItem{
      
        let Btn = UIButton()
        Btn.setImage(UIImage(named:imageName), for: UIControlState.normal)
        Btn.setImage(UIImage(named:imageName), for: UIControlState.highlighted)
        Btn.frame = CGRect(origin: CGPoint(x: 0, y: 0), size: size)
        Btn.sizeThatFits(size)
        let historyItem = UIBarButtonItem(customView: Btn)
        return historyItem;

    }
    
    convenience init(imageName:String,highImageName:String,size:CGSize) {
        let Btn = UIButton()
        Btn.setImage(UIImage(named:imageName), for: UIControlState.normal)
        Btn.setImage(UIImage(named:imageName), for: UIControlState.highlighted)
        Btn.frame = CGRect(origin: CGPoint(x: 0, y: 0), size: size)
        self.init(customView : Btn)
    }
}
